//
//  BRInCabinetViewController.m
//  BrezzeSaaS
//
//  Created by IOS on 2021/11/26.
//  Copyright © 2021 Brezze GWG. All rights reserved.
//

#import "BRInCabinetViewController.h"
#import "BRPaymentViewController.h"

@interface BRInCabinetViewController ()

@end

@implementation BRInCabinetViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self setUI];
}

- (void)bottomClik:(QMUIButton *)btn {
    
    NSInteger tag = btn.tag - 100;
    if (tag == 0) {
        [self.navigationController popToRootViewControllerAnimated:YES];
        return;
    }
    
    BRPaymentViewController *payVC = [[BRPaymentViewController alloc] init];
    
    payVC.amount = self.dto.money;
    payVC.payType = BRPAY_Rent;
    payVC.dto = self.dto;
    payVC.isHiddTips = YES;
    [self.navigationController pushViewController:payVC animated:YES];
    
}


#pragma mark - SET UI --
- (void)setUI {
    
    [self createTop:Localized(@"Report_orderRunning") imageStr:@"arrow_left_gary54"];
    self.titleColor = UIColor.qd_titleTextColor;

    UIImageView *defaultImg = [[UIImageView alloc] init];
    defaultImg.image = UIImage.qd_successImage;
    [self.view addSubview:defaultImg];
    [defaultImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view.mas_top).offset(36 + kSafeAreaTopHeight);
        make.width.height.mas_equalTo(141);
        make.centerX.equalTo(self.view);
    }];
    NSString *titleStr = Localized(@"Order_stillSuccMsg");
    QMUILabel *depositL = [[QMUILabel alloc] init];
    depositL.text = titleStr;
    depositL.textColor = UIColor.qd_titleTextColor;
    depositL.font = [UIFont br_fontB:17];
    depositL.textAlignment = NSTextAlignmentCenter;
    depositL.numberOfLines = 0;
    [self.view addSubview:depositL];
    [depositL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.mas_equalTo(320);
        make.centerX.equalTo(self.view);
        make.top.equalTo(defaultImg.mas_bottom).offset(4);
    }];
    
    // bottom
    NSString *home =  Localized(@"Report_goToPay");
    NSString *leftStr = Localized(@"Payment_backHome");
   
    QMUIButton *payBtn = [[QMUIButton alloc] init];
    [payBtn setTitle:home forState:UIControlStateNormal];
    [payBtn setTitleColor:UIColor.qd_backgroundColor forState:UIControlStateNormal];
    [payBtn setBackgroundImage:UIImage.qd_homeScanBtnImage forState:UIControlStateNormal];
    payBtn.layer.masksToBounds  = YES;
    payBtn.titleLabel.font = [UIFont br_fontB:16];
    payBtn.tag = 101;
    [self.view addSubview:payBtn];
    CGFloat btnWidth = (kScreenWidth - 48) / 2.0;
    [payBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.mas_equalTo(btnWidth);
        make.height.mas_equalTo(50);
        make.left.equalTo(self.view).offset(32 + btnWidth );
        make.bottom.equalTo(self.view).offset(-(kSafeAreaBottomHeight +25.));
    }];
    [payBtn addTarget:self action:@selector(bottomClik:) forControlEvents:UIControlEventTouchUpInside];
    payBtn.hidden = !self.isPay;
    QMUIButton *btn = [[QMUIButton alloc] init];
    [btn setTitle:leftStr forState:UIControlStateNormal];
    [btn setTitleColor:UIColor.qd_tintColor3 forState:UIControlStateNormal];
    [btn setBackgroundColor:UIColorClear];
    btn.layer.borderColor = UIColor.qd_tintColor3.CGColor;
    btn.layer.borderWidth = 1;
    btn.titleLabel.font = [UIFont br_fontB:16];
    btn.tag = 100;
    [self.view addSubview:btn];
    CGFloat btnWidth2 = (kScreenWidth - 48) / 2.0;
    if (!self.isPay) {
        btnWidth2 = kScreenWidth - 32.;
        
    }
    [btn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.mas_equalTo(btnWidth2);
        make.height.mas_equalTo(50);
        make.left.equalTo(self.view).offset(16);
        make.bottom.equalTo(self.view).offset(-(kSafeAreaBottomHeight +25.));
    }];
    [btn addTarget:self action:@selector(bottomClik:) forControlEvents:UIControlEventTouchUpInside];
    
}

- (BOOL)forceEnableInteractivePopGestureRecognizer {
    // 屏蔽右滑返回
    return YES;

}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
